package com.example.w.common.pojo;

import java.io.Serializable;
import java.math.BigDecimal;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * order_item
 * @author 
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OrderItem implements Serializable {
    /**
     * 订单明细id
     */
    private Long id;

    /**
     * 订单id
     */
    private Long orderId;

    /**
     * 菜单项id
     */
    private Long menuItemId;

    /**
     * 数量
     */
    private Integer quantity;

    /**
     * 小计
     */
    private BigDecimal subtotal;

    /**
     * 对应菜品名，用于返回前台
     */
    private String menuItemName;

    private static final long serialVersionUID = 1L;

    /**
     * 判断下单信息是否完整，数量 <=0 的时候也是不完整
     * @return
     */
    public boolean isInfoCompleteForAddition() {
        return quantity != null && quantity > 0 && menuItemId != null;
    }

}